package cn.edu.sjtu.stap.cfg;

/**
 * The kinds of nodes in control flow graph.
 * 
 * @author William
 *
 */
public enum CfgNodeKind {
    //  For SDG only!
    PARAMETER("Parameter"),
    AUXILIARY_NODE(null),
    
    // This part defines the kinds of control flow graph node.
    ENTRY("Entry"),
    CLASS_ENTRY("Class Entry"),
    INTERFACE_ENTRY("Interface Entry"),
    METHOD_ENTRY("Method Entry"),
    CONSTRUCTOR_ENTRY("Constructor Entry"),
    ARTIFICIAL_METHOD_ENTRY("Artificial Method Entry"),
    
//    public static final String ENTRY_S            = "Entry";
//    public static final String CLASS_ENTRY_S      = "Class Entry";
//    public static final String INTERFACE_ENTRY_S  = "Interface Entry";
//    public static final String METHOD_ENTRY_S     = "Method Entry";
//    public static final String CONSTRUCTOR_ENTRY_S= "Constructor Entry";

    EXIT("Exit"),
//    CLASS_EXIT("Class Exit"),
//    INTERFACE_EXIT("Interface Exit"),
    METHOD_RETURNING_EXIT("Method Returning Exit"),
    METHOD_THROWING_EXIT("Method Throwing Exit"),
    CONSTRUCTOR_RETURNING_EXIT("Constructor Returning Exit"),
    CONSTRUCTOR_THROWING_EXIT("Constructor Throwing Exit"),
    ARTIFICIAL_METHOD_RETURNING_EXIT("Artificial Method Returning Exit"),
    ARTIFICIAL_METHOD_THROWING_EXIT("Artificial Method Throwing Exit"),
    
    
//    public static final String EXIT_S             = "Exit";
//    public static final String CLASS_EXIT_S       = "Class Exit";
//    public static final String INTERFACE_EXIT_S   = "Interface Exit";
//    public static final String METHOD_EXIT_S      = "Method Exit";
//    public static final String CONSTRUCTOR_EXIT_S = "Constructor Exit";

    CALL("Call"),
    RETURN("Return"),
    METHOD_CALL("Method Call"),
    CONSTRUCTOR_CALL("Constructor Call"),
    
    WEAVE("Weave"),
    WEAVE_RETURN("Weave Return"),
    
//    public static final String CALL_S             = "Call";
//    public static final String RETURN_S           = "Return";
//    public static final String METHOD_CALL_S      = "Method Call";
//    public static final String CONSTRUCTOR_CALL_S = "Constructor Call";
//    public static final String INSTANCE_CREATION_S= "Instance Creation";
//    public static final String POLYMORPHIC_CALL_S = "Polymorphic Call";

//    public static final int PARAMETER             = 4;
//    public static final int FORMAL_IN             = 41;  // JXConstants.ParameterElem
//    public static final int FORMAL_OUT            = 42;  // JXConstants.ParameterElem
//    public static final int ACTUAL_IN             = 43;  // JXConstants.ASTArguments
//    public static final int ACTUAL_OUT            = 44;  // JXConstants.ASTArguments

//    public static final int assignments      = 5;
//    public static final int assignmentSt     = 51;  // JXConstants.ExpressionElem:Assign
//    public static final int fieldDecl        = 52;  // JXConstants.FieldElem
//    public static final int localDecl        = 53;  // JXConstants.LocalElem
//    public static final int newSt            = 54;  // JXConstants.ExpressionElem:InstanceCreation
//    public static final int returnSt         = 55;  // JXConstants.StatementElem:Return
//    public static final int postfixExp       = 56;  // JXConstants.StatementElem:Return
//    public static final int PrefixExp        = 57;  // JXConstants.StatementElem:Return
    
    EXPRESSION("Expression"),
    BRANCH_EXPRESSION("Condition"),
    ALLOCATION_EXPRESSION("Allocation Expression"),
    AND_AND_EXPRESSION("And-and Expression"),
    ARRAY_ALLOCATION_EXPRESSION("Array Allocation Expression"),
    ARRAY_INITIALIZER_EXPRESSION("Array Initializer Expression"),
    ASSIGNMENT("Assignment"),
    BINARY_EXPRESSION("Binary Expression"),
    CAST_EXPRESSION("Cast Expression"),
    COMPOUND_ASSIGNMENT("Compound Assignement"),
    CONDITIONAL_EXPRESSION("Conditional Expression"),
    EQUAL_EXPRESSION("Equal Expression"),
    INSTANCE_OF_EXPRESSION("Instance-of Expression"),
    OR_OR_EXPRESSION("Or-or Expression"),
    POSTFIX_EXPRESSION("Postfix Expression"),
    PREFIX_EXPRESSION("Prefix Expression"),
    QUALIFIED_ALLOCATION_EXPRESSION("Qualified Allocation Expression"),
    UNARY_EXPRESSION("Unary Expression"),

    STATEMENT("Statement"),
    BLOCK("Block"),
    VARIABLE_DECLARATION("Variable Declaration"),
    BREAK_STATEMENT("Break Statement"),
    CASE_STATEMENT("Case Statement"),
    CONTINUE_STATEMENT("Continue Statement"),
    DO_STATEMENT("Do Statement"),
    EMPTY_STATEMENT("Empty Statement"),
    FOREACH_STATEMENT("Foreach Statement"),
    FOR_STATEMENT("For Statement"),
    IF_STATEMENT("If Statement"),
    LABELED_STATEMENT("Labeled Statement"),
    RETURN_STATEMENT("Return Statement"),
    SWITCH_STATEMENT("Switch Statement"),
    THROW_STATEMENT("Throw Statement"),
    TRY_STATEMENT("Try Statement"),
    WHILE_STATEMENT("While Statement");
    
//    public static final String STATEMENT_S        = "Statement";
//    public static final String ASSIGNMENT_S       = "Assignment";
//    public static final String IF_STATEMENT_S     = "If Statement";
//    public static final String WHILE_STATEMENT_S  = "While Statement";
//    public static final String DO_STATEMENT_S     = "Do Statement";
//    public static final String FOR_STATEMENT_S    = "For Statement";
//    public static final String BREAK_STATEMENT_S  = "Break Statement";
//    public static final String CONTINUE_STATEMENT_S="Continue Statement";
//    public static final String SWITCH_STATEMENT_S = "Switch Statement";
//    public static final String CASE_STATEMENT_S   = "Case Label";
//    public static final String DEFAULT_LABEL_S    = "Default Label";
//    public static final String TRY_STATEMENT_S    = "Try Statement";
//    public static final String THROW_STATEMENT_S  = "Throw Statement";
//  public static final int synchronizedSt   = 71;  // JXConstants.StatementElem:Syncronized
    
//    public static final int ifAspect         = 73;
//
//    public static final int ignores          = 9;   // ignored in PDGs.
//    public static final int labelSt          = 91;  // JXConstants.LabelElem
//    public static final int mergeSt          = 92;
    
    private CfgNodeKind(String name) {
        this.name = name;
    }
    
    public String getName() {
        return name;
    }
    
    private String name;
}
